<section class="objectentries panel rounded">
	<h1><?php printf(lang('title_object_entries'),$object->table); ?></h1>
	
	<div class="table">
		<div class="thead">
			<div class="th summary"><?php echo lang('heading_summary'); ?></div>
			<div class="th actions"><?php echo lang('heading_actions'); ?></div>
			<div class="clear"></div>
		</div>
		<div class="tbody">
			<?php foreach ($entries as $entry) { ?>
			<form id="row<?php echo $entry->id; ?>" class="row">
				<div class="td summary">
					<?php
						$summary = ''; 
						$this->load->helper('text'); 
						foreach ($fields as $field) {
							if ($field->type != 'i18n_string')
							switch ($field->name) {
								case 'created_by':
								case 'created_at':
								case 'modified_by':
								case 'modified_at':
									break;
								default:
									$summary.= $field->name.'=>"'.ellipsize($entry->{$field->name},16,.75). '" ';
							}
						}
						echo $summary;
					?>
				</div>
 
				<div class="td actions">
					<?php if ($this->user->is_editor()) { ?>
					<a href="api/data/delete/<?php echo $object->id.'/'.$entry->id; ?>"><?php echo lang('action_delete'); ?></a>
					<a href="objects/<?php echo $object->id; ?>/entries/<?php echo $entry->id; ?>"><?php echo lang('action_edit'); ?></a>
					<?php } else { ?>
					<a href="objects/<?php echo $object->id; ?>/entries/<?php echo $entry->id; ?>"><?php echo lang('action_view'); ?></a>
					<?php } ?>
				</div>
			
				<div class="clear"></div>			
			</form>
		
			<?php } 			

			if ($this->user->is_editor()) { ?>
			<form class="new">
				<div class="td summary">
				</div>
				<div class="td actions">
					<a href="objects/<?php echo $object->id ?>/new"><?php echo lang('action_insert'); ?></a>				
				</div>
				<div class="clear"></div>						
			</form>
			<?php } ?>
		</div>
	
	</div>
</section>

<?php if (!$this->user->is_editor()) { ?>
<script>
	$('input').attr('readonly','readonly');
</script>
<?php } ?>
